<?
require("config.php");

$location_status .= "| Edit";
$show_backnav = "user_menu";
$menuname = NULL;
$menutarget = NULL;

if (NULL!=$action){

   $field = array(
	"code", 
	"username", 
	"password", 
	"name",
	"tel",
    "fax",
	"email",
	"alert01",
	"alert02",
	"alert03",
	"alert04",
	"alert05",
	"alert06",
	"type",
	"alert07",
	);


   $content = array(
	$Code, 
	$Username, 
	$Password, 
	$Name,
	$Tel,
	$Fax,
	$Email,
	$Alert01,
	$Alert02,
	$Alert03,
	$Alert04,
	$Alert05,
	$Alert06,
	$Type,
	$Alert07,
	);

	$exp = "id=$id";

   myUpdate($table,$field,$content,$exp);

   header("location:" . $rela_path . "share/msg.php?v=54");

   exit();

}else{

  if (!checkRecord($table,$id)){

	header("location:" . $rela_path . "share/msg.php?v=9002");

	exit();
  
  }

}


$Query = "SELECT 
	code, 
	username, 
	password, 
	name,
	tel,
    fax,
	email,
	alert01,
	alert02,
	alert03,
	alert04,
	alert05,
	alert06,
	type,
	id, alert07
FROM $table WHERE id=$id LIMIT 1";

$r=myQuery($Query);

$Code=$r[0][0];
$Username=$r[0][1];
$Password=$r[0][2];
$Name=$r[0][3];
$Tel=$r[0][4];
$Fax=$r[0][5];
$Email=$r[0][6];
$Alert01=$r[0][7];
$Alert02=$r[0][8];
$Alert03=$r[0][9];
$Alert04=$r[0][10];
$Alert05=$r[0][11];
$Alert06=$r[0][12];
$Type=$r[0][13];
$Id=$r[0][14];$Alert07=$r[0][15];

require($rela_path . "inc/header.php");

?>



<form action="" method="post" name="form1">
<input name="action" type="hidden" value="edit">
<input name="id" type="hidden" value="<?print($id)?>">




<table width="95%" border="0" align="center">
  <tr> 
    <td width="579" valign="top" height="293"> <div align="right"><br>
      </div>
      <table border="0" cellspacing="0" cellpadding="2">
        <tr> 
          <td width="137" class="tdheader">Code :</td>
          <td width="455"> <input type="text" class="text" name="Code" value="<?print($Code)?>"> </td>
        </tr>

        <tr> 
          <td width="137" class="tdheader">Status :</td>
          <td width="455">
<?
if ($admin_type<9) {
	print(loadType($Type));
	print("<input name=\"Type\" type=\"hidden\" value=\"$Type\">");
}else{
	print(selectType($Type));
}
?>
		  </td>
        </tr>
        <tr> 
          <td width="137" class="tdheader">Username :</td>
          <td width="455"> <input type="text" class="text" name="Username"  value="<?print($Username)?>"> 
          </td>
        </tr>
        <tr> 
          <td width="137" class="tdheader">Password :</td>
          <td width="455"> 
		  <input type="text" class="text" name="Password" value="<?print($Password)?>"> 
          </td>
        </tr>
        <tr> 
          <td width="137" height="3" class="tdheader">Name</td>
          <td width="455" height="3"> 
		  <input type="text" class="text" name="Name" size="40" value="<?print($Name)?>" 
          </td>
        </tr>
        <tr> 
          <td width="137" class="tdheader">Tel :</td>
          <td width="455"> 
		  <input type="text" class="text" name="Tel" size="40" value="<?print($Tel)?>"> 
          </td>
        </tr>
        <tr> 
          <td width="137" class="tdheader">Fax :</td>
          <td width="455"> 
		  <input type="text" class="text" name="Fax" size="40" value="<?print($Fax)?>"> 
          </td>
        </tr>
        <tr> 
          <td width="137" class="tdheader">Email :</td>
          <td width="455"> 
		  <input type="text" class="text" name="Email" size="40" value="<?print($Email)?>"> 
          </td>
        </tr>
        <tr> 
          <td width="137" class="tdheader">Receive Alert Email</td>
          <td width="455"> 
		  
		  <?
		  if ($Alert01=="y") $active1 = "CHECKED";
		  if ($Alert02=="y") $active2 = "CHECKED";
		  if ($Alert03=="y") $active3 = "CHECKED";
		  if ($Alert04=="y") $active4 = "CHECKED";
		  if ($Alert05=="y") $active5 = "CHECKED";
		  if ($Alert06=="y") $active6 = "CHECKED";
		  if ($Alert07=="y") $active7 = "CHECKED";
		  
		  ?>
		  <input type="checkbox" name="Alert01" value="y" <?print($active1)?>>
            Course Enrollment<br> <input type="checkbox" name="Alert02" value="y" <?print($active2)?>>
            Contact Us<br> <input type="checkbox" name="Alert03" value="y" <?print($active3)?>>
            Customer Catalog Request<br> <input type="checkbox" name="Alert04" value="y" <?print($active4)?>>
            Learning Zone Sign Up<br> <input type="checkbox" name="Alert05" value="y" <?print($active5)?>>
            Newsletter Subscription<br> <input type="checkbox" name="Alert06" value="y" <?print($active6)?>>
            Coaching Booking <br />
          <input type="checkbox" name="Alert07" value="y" <?print($active7)?> /> 
          Acuity Evening Sign Up
			
			
			</td>
        </tr>
        <tr> 
          <td width="137">&nbsp;</td>
          <td width="455"> 
		  <input type="image" src="../../images/bt_cancel.gif" onClick="Redirect('user_menu.php',1);return false;"> <input type="image" src="../../images/bt_save.gif">
          </td>
        </tr>
      </table></td>
  </tr>
</table>
<br>
<br>
<br>
</form>
<?
require($rela_path . "inc/footer.php");
?>
